#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include "ui_MainWindow.h"
#include <QtCore/QTimer>
#include <QProcess>
#include "core/stringdefines.h"
#include "graphic/framelistener.h"

namespace EarthView
{
	namespace World
	{
		namespace Spatial3D
		{
			class CGlobeCamera;
			class CGeoSceneManager;
			namespace Controls
			{
				class CGlobeControl;
			}
			namespace Analysis
			{
				class CAnalysis3DMeasureLength;
			}
			namespace Atlas
			{
				class CFeatureGroupLayer;
			}
		}
		namespace Spatial
		{
			namespace Math
			{
				class CVector2;
			}
		}
	}
}

class CScreenScutcheon;
class CScreenScutcheonManager;
class AreaMeasure;
class DistanceMeasure;
class CScutcheonEventObject;
class Theme;
class Location;
class LeaderMap;
class CGlobeMoveListener;
class exitform;
class MainWindow : public QMainWindow
{
	Q_OBJECT

public:

	MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);

	~MainWindow();

	CScreenScutcheon* createScutcheon(const EVString& name, 
		const EarthView::World::Spatial::Math::CVector2& pos,
		ev_real64 width,
		ev_real64 height,
		bool visible=true
		);

	EVString isInGroupLayer(const EVString& groupName);

	EVString isInLayer(EarthView::World::Spatial3D::Atlas::CFeatureGroupLayer* fg);

	void cityCountyProfile();

	void distanceMeasure();

	void areaMeasure();

	void switchImage();

	void showExitFrm();

	//void showLayerManager();

	//void showPlaceName();

	void fortyfiveDegree();

	void north();

	void lookDown();

	void horizontalLook();

	void showHelp();

	//void showVector();

	void showTheme();

	void showLocation();

	void showLeaderMap();

	void switchCityAttribute();

	private slots:

	   void slotGlobeOpened(GlobeWidget* globeWidget);

	   void slotResize(qint32 w, qint32 h);

       //void slotTimerUpDate();

	   void slotTimerUpDate1();

private:

	Ui::MainWindowClass ui;

	QTimer mTimer;

	QTimer mTimer1;

	EarthView::World::Spatial3D::Controls::CGlobeControl* mpGlobeControl;

	EarthView::World::Spatial3D::CGeoSceneManager* mpGeoSceneManager;

	EarthView::World::Spatial3D::CGlobeCamera* mpGlobeCamera;

	//bool mLayerManagerVisible;

	bool mVectorVisible;

	//bool mCityAttribute;

	//bool mPlaceNameVisible;

	//bool mShow3D;

	bool mCurrentImgSwitch;

	ev_int32 mTrans;

	QProcess mProcess;

	//AtlasWidget* mpAtlasWidget;
	EVString mStartPath;

	Location* mpLocation; 

	Theme* mpTheme;

	DistanceMeasure* mpDistanceMeasure;

	AreaMeasure* mpAreaMeasure;

    LeaderMap* mpLeaderMap;

	exitform* mpExitFrm;

	CScutcheonEventObject* mpEventObject;
	//CScreenScutcheon* mpScreenScutcheon1;
	CScreenScutcheonManager* mpScreenScutcheonManager;

	CGlobeMoveListener* mpListener;

};

class CGlobeMoveListener : public EarthView::World::Graphic::CFrameListener
{

public:

	CGlobeMoveListener(EarthView::World::Spatial3D::CGlobeCamera* ref_cam);

	~CGlobeMoveListener();

	virtual ev_bool frameRenderingQueued(const EarthView::World::Graphic::FrameEvent &evt);

	bool getEnabled() const;

private:

	EarthView::World::Spatial3D::CGlobeCamera* mpGlobeCamera;

	bool mEnable;

	ev_int32 mCount;


};

#endif // MainWindow_H
